/*
 * File:   evolutionSP.hpp
 * Author: gian
 *
 * Created on December 11, 2012, 12:37 AM
 */

#ifndef EVOLUTIONSP_HPP
#define EVOLUTIONSP_HPP

#include <pthread.h>
#include "latticeSP.hpp"
#include "FriedmannEvolution.hpp"

#define MAX_THREADS 50
class evolutionSP {
  public:
    evolutionSP(double dh,
                double dt);

    evolutionSP(const evolutionSP & orig);

    evolutionSP(double dh,
                double dt,
                int    lsizex,
                int    lsizey,
                int    lsizez,
                int    nx,
                int    ny,
                int    nz);

    virtual ~evolutionSP();

    void operator ()(latticeSP *          src,
                     latticeSP *          dst,
                     FriedmannEvolution * frw);

    double deltaT();

    double deltaH();

    void set_dt(double dt);

  private:
    struct evolution_step_args {
      evolutionSP * evol;
      int           xmin;
      int           xmax;
      int           ymin;
      int           ymax;
      int           zmin;
      int           zmax;
    };


    int                   mThreadNumber;
    evolution_step_args * mThreadArguments;
    pthread_t             mThreads[MAX_THREADS];

    static void * evolution_step(void * args);

    latticeSP * mLattice1;
    latticeSP * mLattice2;
    double      mA0;
    double      mA1;
    double      mA2;
    int         mLatticeSizeX;
    int         mLatticeSizeY;
    int         mLatticeSizeZ;
    int         mPartitionX;
    int         mPartitionY;
    int         mPartitionZ;
    double      mdh;
    double      mdt;
};
#endif /* EVOLUTIONSP_HPP */


//~ Formatted by Jindent --- http://www.jindent.com
